"""@file
   Test main entry.   
   
   @par license 
   Copyright 2012 Lu, Ken. All rights reserved.

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 
   @author: Lu, Ken (bluewish.ken.lu@gmail.com)
"""

import unittest
import syspydll
from ctypes import *

class FunctionBaseTest(unittest.TestCase):
    
    def setUp(self):
        pass
    
    def tearDown(self):
        pass
    
    def test_1(self):
        length = c_ulong(0x1000)
        buffer = (c_ubyte * 0x1000)()
        ret = syspydll.syspy_mmio_read(0x10000, length, buffer)
        self.assert_(ret == syspydll.SYSPY_OK, "Failure")
        
    def test_2(self):
        length = c_ulong(0x1000)
        buffer = (c_ubyte * 0x1000)()
        ret = syspydll.syspy_mmio_read(0xffff0000, length, buffer)
        self.assert_(ret == syspydll.SYSPY_OK, "Failure")

    def test_3(self):
        length = c_ulong(0x1000)
        buffer = (c_ubyte * 0x1000)()
        ret = syspydll.syspy_mmio_read(0xfffff000, length, buffer)
        self.assert_(ret == syspydll.SYSPY_OK, "Failure")
        
    def test_4(self):
        length = c_ulong(0x1000000)
        buffer = (c_ubyte * 0x1000000)()
        ret = syspydll.syspy_mmio_read(0x0, length, buffer)
        self.assert_(ret == syspydll.SYSPY_OK, "Failure")        